package com.angel.bo.admin.service.impl;

import com.angel.bo.admin.service.DictInfoService;
import com.angel.bo.beans.admin.entity.Dict;
import com.angel.bo.beans.admin.entity.DictInfo;
import com.angel.bo.common.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.angel.bo.admin.mapper.DictMapper;
import com.angel.bo.admin.service.DictService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * 
 *
 * @author ${author}
 * @email haibo.mei@ge.com
 * @date 2018-02-02 15:03:26
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DictServiceImpl extends BaseServiceImpl<DictMapper,Dict> implements DictService {

    @Autowired
    private DictInfoService dictInfoService;

    /**
     * 初始化字典值，进行缓存
     */
    @Override
    public void initCacheDictInfo(){
        List<Dict> dicts = super.selectListAll();
        for (Dict dict : dicts) {
            DictInfo dictInfo = new DictInfo();
            dictInfo.setDictCode(dict.getDictCode());
            dictInfoService.getDictInfo(dictInfo);

        }
    }
}



